import 'dart:math';

import 'package:flutter/material.dart';

class Util {
  pd(Widget w, {double l, double t, double r, double b}) {
    return Padding(
      child: w,
      padding: EdgeInsets.fromLTRB(l ?? 0, t ?? 0, r ?? 0, b ?? 0),
    );
  }

  pda(Widget w, double a) {
    return Padding(
      child: w,
      padding: EdgeInsets.all(a ?? 0),
    );
  }

  pdhv(Widget w, {double h, double v}) {
    return Padding(
      child: w,
      padding: EdgeInsets.fromLTRB(h ?? 0, v ?? 0, h ?? 0, v ?? 0),
    );
  }

  bg(Widget w, [Color color]) {
    return Container(
      color: color ?? randomColor(),
      child: w,
    );
  }

  Color randomColor() {
    Random random = new Random();
    int r = 30 + random.nextInt(200);
    int g = 30 + random.nextInt(200);
    int b = 30 + random.nextInt(200);
    int a = 30 + random.nextInt(200);
    return Color.fromARGB(a, r, g, b);
  }
}
